/*
 * Copyright (c) 2018. eqxiu.com 北京中网易企秀科技有限公司  All rights reserved.
 */

package com.seelyn.flow.engine;

import java.util.HashMap;
import java.util.Map;

/**
 * @author linfeng-eqxiu
 * @description //TODO 设计说明
 * @date 2018/10/24
 */
public class WorkFlowParams {

    private final Map<String, Object> params;

    public WorkFlowParams() {
        this.params = new HashMap<>();
    }

    public void put(String key, Object obj) {
        this.params.put(key, obj);
    }

    public void putAll(Map<String, Object> params) {
        this.params.putAll(params);
    }

    public String getString(String key) {
        return String.valueOf(this.params.get(key));
    }

    public Integer getInteger(String key) {
        return Integer.parseInt(getString(key));
    }

    public Float getFloat(String key) {
        return Float.parseFloat(getString(key));
    }

    public <T> T getT(String key, Class<T> clazz) {
        //noinspection unchecked
        return (T) this.params.get(key);
    }
}
